Alibabacloud.com offers a wide variety of articles about spring annotations tutorial, easily find your spring annotations tutorial information here online.
Http://www.mossle.com/docs/springsecurity3/html/ns-config.html#ns-minimalThis is a 3.0 Chinese document, written in more detail, as well as the latest version of Spring in action also has a chapter specifically about this. Download the demo from Spring Security's GitHub on the learning process, where Tutorial-xml is the simplest demo. In the source code, I put in
I. Combination annotations and meta-annotationsStarting with spring 2, in response to the annotation functionality introduced by JDK 1.5, spring began to add annotations to replace the XML configuration in large numbers. Spring annotatio
A detailed description of common annotations in Spring, spring annotations
Description of the configuration file when annotations are used in spring:
The following describes the usage of some common
Common Spring annotations and spring annotations
Enable automatic scanning before using annotations
The base-package is the package to be scanned (including the sub-package ).
@ Configuration regards a class as an IoC container. If @ Bean is registered in a method header, it
Spring Note Description Spring2.5 Note Introduction (3.0 General) Register Note processorWay One: BeanWay Two: namespacesThe spring container is implicitly registered with the Autowiredannotationbeanpostprocessor, Commonannotationbeanpostprocessor,Persistenceannotationbeanpostprocessor and Requiredannotationbeanpostprocessor the 4 beanpostprocessor.Way Three: namespacesIf you want to make
When you start using frames like spring and hibernate,mybatis the year before, you go to annotations. Until some time ago, suddenly began to curiosity about the annotations. Why do you write annotations? You don't need a lot of configuration files. So I looked at some of the data and had a preliminary understanding of
In the process of using spring, to avoid extensive use of the bean-injected XML configuration file, we use the spring-provided automatic scan injection method,Just add a few lines of auto-injected configuration, you can complete the service layer, controller layer and so on injection configuration.In the process of use, @compopnet annotations are added to the imp
Spring common annotations use annotations to construct IoC containers. springioc
Construct an IoC Container Using annotations
Use annotations to register beans with Spring containers. You must register
For example, specify a pack
Spring annotation
1. Preparatory work(1) Import Common-annotations.jar(2) Import schema file file name is Spring-context-3.0.3.release.jar(3) Configuring in the Beans node of XML
2.xml Configuration Work
Note: This configuration implicitly registers multiple processors that resolve annotations, such as:
Autowiredannotationbeanpostprocessor
Commonannotationbe
Spring Notes 2-annotations, spring2-Annotations
I. Differences between attributes and member variables:Attribute: exposed. getxxx/setxxx is called an attribute;Member variable: private String name is a member variable or field.
2. Writing applicationContext. xmlXmlns = "http://www.springframework.org/schema/beans"Xmlns: xsi = "http://www.w3.org/2001/XMLSchema-ins
Spring not only supports its own defined @autowired annotations, it also supports several annotations defined by the JSR-250 specification, namely @resource, @PostConstruct, and @predestroy.The function of the @Resource is equivalent to @autowired, but @autowired is automatically injected by Bytype, and @resource is automatically injected by ByName by default. @R
differently than others. In the implementation of Asyncannotationbeanpostprocessor (the specific code is in its parent class abstractadvisingbeanpostprocessor), a problem is found,Normally, the bean that comes in is already the agent's dynamic proxy class, and when it fails, it comes in really real class, such as:Then in the analysis of the code, if the actual class, go to 69 rows, the return is true, the @aysnc advisor added to the dynamic truth, and if the actual class, go to 83 rows, will cr
Spring not only supports its own defined @autowired annotations, it also supports several annotations defined by the JSR-250 specification, namely @resource, @PostConstruct, and @predestroy. the function of the @Resource is equivalent to @autowired, but @autowired is automatically injected by Bytype, and @resource is automatically injected by ByName by default.
I. @Component, @Repository, @Service, @Controller differencesSpring 2.5in addition to providing @Componentannotations, several annotations with special semantics are defined, namely: @Repository, @Service, and @Controller. In the current Spring version, this 3a comment and @Componentis equivalent, but from the name of the annotation class, it is easy to see that these 3
XML configuration files are almost completely deprecated in spring boot, and the topic of this article is to analyze commonly used annotations.Spring was initially designed to address the intrusion of large enterprise frameworks such as EJBS into applications, so relying heavily on configuration files for "non-intrusive" pojo added functionality, but starting with spring 3.x, one of the most popular things
Elementtype.type: Description class, interface, enum, annotation
@RetentionDefines the duration of the annotation (source file, bytecode, run time).To illustrate the extent to which the annotations described are in effect.The value is unique, that is, one of the specific save policies, Retentionpolicy (enum).@Documented @retention (retentionpolicy.runtime) @Target (elementtype.annotation_type) public @Interface Retention { /** * Ret
@Lazy is used to specify whether the bean cancels pre-initialization. Mainly used to decorate the spring bean class to specify the pre-initialization behavior of the bean.When you use this annotation, you can specify a Boolean value property that determines whether to pre-initialize the bean
Lazy represents the delay load, lazy=false, non-delay, if object A also has a reference to object B, will be in the XML mapping file A To configure B's o
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.